1. Field of the Invention
This invention relates to a microprocessor device and an emulator device used for the microprocessor application device, and, in particular, relates to a microprocessor with an improved configuration and an emulator with an improved configuration by which simple debugging can be carried out for the development of a microprocessor application system.
2. Description of the Prior Art
An emulator device as a system for assisting in debugging during the development of a microprocessor application system is commonly known. This emulator device controls the operation of a microprocessor device (hereinafter referred to as "microprocessor") incorporated in the microprocessor application system. In addition, it assists the debugging of the microprocessor application system by observing the operational state of the microprocessor.
In particular, one of the important functions of the emulator device is real-time tracing for observing microprocessor operations in real time. Trace information is information about a real-time tracing operation. The trace information is generated only from information obtained by observing a chip bus in the microprocessor because the microprocessor operations are observed under real-time conditions. The relationship between the execution of an instruction and instruction fetch and operand access in a microprocessor with a simple configuration is uncomplicated, therefore the trace information can be readily obtained by merely observing the instruction and operand information on the chip bus.
On the other hand, methods such as prefetching of an instruction and operand and buffering for writing an operand are widely used in a high performance microprocessor. The relationship between the order in which the instructions are executed and the order in which the operands are accessed becomes complex when these methods are used in such a high performance microprocessor. Accordingly, the analysis of the operational state of the microprocessor by merely observing the information on the chip bus is too difficult. In this case, debugging of the application system incorporating the high performance microprocessor is also difficult.
Problems associated with the conventional microprocessor and emulator device will now be explained. For example, instructions and operands are generally prefetched for high-speed operation based on a pipeline processing method in a conventional high-performance microprocessor. Such a microprocessor comprises a plurality of prefetch queues for temporarily storing prefetched instructions and operands. Then, prefetched instructions other than branch instructions stored in the prefetch queues are executed in the order in which they are stored. The prefetched operands in the queues are used for the prefetching instructions.
All data in the queues is purged, and the instructions and operands stored in the queues after the execution of a branch instruction are eliminated when the result of the executed branch instruction is true. In this case, the eliminated instructions and operands are not executed by the microprocessor. The conventional microprocessor has no means for outputting information about the eliminated instructions and operands to an external device.
A microprocessor for evaluation of chips which can output to an external device information about executed instructions and operands used is known. However, in addition to the address bus, this microprocessor has an output bus used only for outputting this information. In this case, an additional pin is required in the microprocessor for outputting this information so that the total number of pins in the microprocessor is greater than in a microprocessor which has no such dedicated output bus.
As described above, a conventional microprocessor has no function by which information about eliminated instructions and operands is output to an external device. Therefore the following two problems exist in the prior art.
The first problem concerns the real-time trace function which is an important function in the emulator device. Input/Output signals are stored in memory in accordance with a predetermined timing cycle by the real-time trace function, and the contents stored in the memory are then analyzed for display.
All instructions stored in the queues are purged on the execution of a branch instruction in the prefetched instructions when the result of the branch instruction execution is true in a microprocessor with a prefetch function, and there is no target instruction for the branch instruction in the queues. Further, the microprocessor fetches the target instruction for the branch instruction. In this case, the purged instructions are stored in the trace memory. Accordingly, actual executed instructions differ from those instructions stored in the trace memory.
The second problem is that the conventional microprocessor has no means for detecting whether the result of the branch instruction execution is true or not. For example, the microprocessor executes no fetch instruction when the target instruction for the branch instruction is stored in the queues and the result of the branch instruction execution is true. Accordingly, information as to whether the result of the branch instruction execution is true or not cannot be transmitted externally. In other words, a device external to the microprocessor is required to detect the result of the branch instruction execution. However, this external device cannot detect which branch instruction has been executed and whether the result is true or not when a large number of branch instructions, each of whose target addresses is same when the result of each branch instruction is true, are stored in the queues and many of these branch instructions are executed.
On the other hand, the two problems described above can be eliminated when the evaluation microprocessor is an evaluation chip with an output bus for outputting the information from an executed program counter (PC). However, the configuration of this evaluation microprocessor differs from the configuration of a microprocessor used in actual microprocessor application systems.